package com.zx.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zx.springboot.pojo.User;
import com.zx.springboot.producer.MessegeProducer;

@Controller
public class HelloController {
	
	@Autowired MessegeProducer messegeProducer;
	
	@RequestMapping("/hello/{name}")
	@ResponseBody
    public String hello(@PathVariable(value = "name") String name){
		User user = new User();
		user.setId(1);
		user.setName(name);
		System.out.println("producer-9000:"+user);
		messegeProducer.sendDirectQueue(user);
		messegeProducer.sendTopicQueue2(user); 
        return name;
    }
}
